{template 'common/header'}

<div class='container' style='padding:0 5px 10px;margin:0;width:100%'>
	<ul class="nav nav-tabs">
	  <li {if $op == 'post'}class="active"{/if}><a href="{php echo $this->createWebUrl('activity', array('op' => 'post'));}">添加项目</a></li>
	  <li {if $op == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('activity',array('op'=>'display'));}">管理项目</a></li>
	  <li><a href="{php echo $this->createWebUrl('category');}">分类管理</a></li>
	</ul>
	{if $op =='display'}
		<div class="panel panel-success">
		  <div class="panel-heading">常用工具 > 项目列表</div>
		</div>
		<form id="form2" class="form-horizontal" method="post">
			<table class="table table-hover">
				<thead class="navbar-inner">
					<tr>
						<th style="width:40px;">全选</th>
	          			<th style="width:80px;">项目类别</th>
	          			<th style="width:110px;">名称</th>
	          			<th style="width:130px;">信息反馈</th>
	          			<th style="width:80px;">特色图片</th>
	          			<th style="width:50px;">捐款总数</th>
	          			<th style="width:40px;">目标</th>
	          			<th style="width:30px;">置顶</th>
						<th style="min-width:80px;width:80px;">编辑</th>
					</tr>
				</thead>
				<tbody>
					{loop $list $item}
					<tr>
						<td><input type="checkbox" value="{$item['pro_id']}" name="delete[]"></td>
						<td>{$item['class_name']}</td>
						<td>{$item['pro_name']}</td>
						<td>{$item['pro_short']}</td>
						<td><img src="{$_W['attachurl']}{$item['pro_feature']}" style="width:100px"></td>
						<td>{$item['pro_fund']}</td>
						<td>{$item['pro_goal']}</td>
						<td><?php if($item['pro_stick'] == "1"){echo "是";}else{echo "否";}?></td>
						<td>
						<a href="{php echo $this->createWebUrl('activity', array('op' => 'post', 'pro_id' => $item['pro_id']))}" title="编辑" class="btn btn-xs btn-primary"><span class="icon icon-compose">编辑</span></a>
						
						<a onclick="if(confirm('此操作不可恢复，确认吗？')){location.href='{php echo $this->createWebUrl('activity', array('pro_id' => $item['pro_id'],'op'=>'del'))}'}" href="javascript:;" title="删除" class="btn btn-xs btn-danger"><span class="icon icon-close">删除</span></a>
						<a href="{php echo $this->createWebUrl('fund',array('pro_id'=>$item['pro_id']));}" class="btn btn-xs btn-info"><span class="icon icon-compose">明细</span></a>
						</td>				
					</tr>
					{/loop}
					<tr >
						<td><input type="checkbox"  onclick="var ck = this.checked;$(':checkbox').each(function(){this.checked = ck});" name=''>
							<input class="btn btn-primary btn-xs" type="submit" value="删除" name="submit" >
						</td>
						<td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
					</tr>
				</tbody>
			</table>
			<input type="hidden" value="activity" name="do">
			<input type="hidden" value="del" name="op">
			<input type="hidden" name="token" value="{$_W['token']}" />
		</form>
		{$pager}
		
		<script>
			$('#form2').submit(function(){
				if($(":checkbox[name='delete[]']:checked").size() > 0){
					return confirm('删除后不可恢复，您确定删除吗？');
				}
				return false;
			}); 
		</script>	
	</div>
	{elseif $op == 'post'}
	<div class="panel panel-success">
	    <div class="panel-heading">常用工具 > 添加/修改项目</div>
	</div>
	<div class="main">
		<form action="" method="post" class="form-horizontal form">
			<div class="panel panel-default">	
				<div class="panel-body">
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">项目类别</label>
						<div class="col-sm-8">
							<select name="class_id" class="form-control">
							{loop $class $row}
								<option value="{$row['class_id']}" <?php if($row['class_id']==$item['class_id']){?>selected="selected"<?php }?> >{$row['class_name']}</option>
							{/loop}
							</select>
							<span class="help-block"></span>
						</div>
					</div>	
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">善款接收机构</label>
						<div class="col-sm-8">
							<select name="company_id" class="form-control">
							{loop $company $row}
								<option value="{$row['company_id']}" <?php if($row['company_id']==$item['company_id']){?>selected="selected"<?php }?> >{$row['company_name']}</option>
							{/loop}
							</select>
							<span class="help-block"></span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">项目名称</label>
						<div class="col-sm-8">
							<input type="text" name="pro_name" class="form-control" value="{$item['pro_name']}" />
							<span class="help-block"></span>
						</div>
					</div>	
					<!--<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">项目简介</label>
						<div class="col-sm-8">
							<input type="text" name="pro_short" class="form-control" value="{$item['pro_short']}" />
							<span class="help-block"></span>
						</div>
					</div>-->
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">特色图片</label>
						<div class="col-sm-8">
							{php echo tpl_form_field_image('pro_feature',$item['pro_feature']);}
							<span class="help-block">建议尺寸240*200</span>
						</div>
					</div>	
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">信息反馈</label>
						<div class="col-sm-8">
							<input type="text" name="pro_gress" class="form-control" value="{$item['pro_gress']}" />
							<span class="help-block"></span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">项目详情</label>
						<div class="col-sm-8">
							{php echo tpl_ueditor('pro_content', $item['pro_content']);}
							<span class="help-block"></span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">已捐款数</label>
						<div class="col-sm-offset-1 input-group col-sm-4" style="padding:0 15px;">
				            <input type="text" class="form-control span7" name="pro_fund" value="{$item['pro_fund']}" disabled="disabled"><div class="input-group-addon">元</div>
				        </div>
					</div>
					<div class="form-group">
				        <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">目标筹集</label>
				        <div class="col-sm-offset-1 input-group col-sm-4" style="padding:0 15px;">
				            <input type="text" class="form-control span7" name="pro_goal" value="{$item['pro_goal']}"><div class="input-group-addon">元</div>
				        </div>
				    </div>
				    <div class="form-group">
			            <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"><span class='red'>*</span>项目开始时间</label>
			            <div class="col-sm-4 col-xs-12">
			                {php echo tpl_form_field_date('starttime',$item['starttime'],true)}
			            </div>
			        </div>
			        <div class="form-group">
			            <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"><span class='red'>*</span>项目结束时间</label>
			            <div class="col-sm-4 col-xs-12">
			                {php echo tpl_form_field_date('endtime',$item['endtime'],true)}
			            </div>
			        </div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">置顶</label>
						<div class="col-sm-8">
							<input name="pro_stick" type="radio" value="1" <?php if($item['pro_stick']=="1"){?>checked="checked"<?php }?>/> 是 &nbsp;&nbsp;&nbsp;&nbsp;
							<input name="pro_stick" type="radio" value="0" <?php if($item['pro_stick']=="0"){?>checked="checked"<?php }?>/> 否
							<span class="help-block"></span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">超过目标筹集金额是否接受捐款</label>
						<div class="col-sm-8">
							<input name="pro_uber" type="radio" value="1" <?php if($item['pro_uber']=="1"){?>checked="checked"<?php }?> /> 是 &nbsp;&nbsp;&nbsp;&nbsp;
							<input name="pro_uber" type="radio" value="0" <?php if($item['pro_uber']=="0"){?>checked="checked"<?php }?>/> 否							
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
						<div class="col-sm-4">
							<input type="hidden" name="pro_id" value="{$item[pro_id]}">
							<input type="hidden" name="token" value="{$_W['token']}" />
							<input name="submit" type="submit" value="提交" class="btn btn-primary span3" />
						</div>
					</div>	
				</div>
			</div>
		</form>
	</div>
{/if}		
</div>

{template 'common/footer'}
